package cn.szzsi.business.validator;

import cn.szzsi.common.util.CommonUtil;
import cn.szzsi.model.Role;
import com.jfinal.core.Controller;
import com.jfinal.validate.Validator;

/**
 * Created by haotian on 2016/9/26.
 */
public class BusinessRoleValidator extends Validator {

    @Override
    protected void validate(Controller c) {
        validateRequiredString("businessRole.name", "nameMessages", "角色名称不允许为空!");
    }

    @Override
    protected void handleError(Controller c) {
        c.keepModel(Role.class);
        c.render(CommonUtil.TEMPLATE_PATH+"/business/role_input.html");
    }
}